package com.xuzhijie.pms.controller;


import com.xuzhijie.pms.common.Result;
import com.xuzhijie.pms.entity.Feedback;
import com.xuzhijie.pms.entity.MoveRequest;
import com.xuzhijie.pms.service.IMoveRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 许志杰
 * @since 2024-02-17
 */
@RestController
@RequestMapping("/move-request")
public class MoveRequestController {

    @Autowired
    private IMoveRequestService service;

    @GetMapping("/page")
    public Result findPage(@RequestParam Integer page,
                           @RequestParam Integer size,
                           @RequestParam Integer processingStatus,
                           @RequestParam Integer isHaveNumber) {

        return service.findPage(page, size,processingStatus,isHaveNumber);
    }

    @PostMapping("/addmr")
    public Result addmr(@RequestBody Map<String,Object> request){
        String description = request.get("description").toString();
        String phone = request.get("phone").toString();
        String images = request.get("images").toString();
        String carNumber = request.get("carNumber").toString();
        String plateNumber = request.get("plateNumber").toString();
        return service.addrepair(description,phone,images,carNumber,plateNumber);
    }

    @GetMapping("/moveRequestById")
    public Result feedbackInfoById(@RequestParam String MQid){
        MoveRequest byId = service.getById(MQid);

        return Result.success(byId);
    }
}

